package com.objecteffects.ilmp.tumblr.method;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

@JsonInclude(JsonInclude.Include.ALWAYS)
public class UserInfo {
    private final Meta meta;
    private final InfoResponse infoResponse;

    // @JsonIgnore
    private final Map<String, Object> additionalProperties = new HashMap<>();

    @JsonCreator
    public UserInfo(@JsonProperty("meta")
    final Meta _meta, @JsonProperty("response")
    final InfoResponse _infoResponse) {
        this.meta = Objects.requireNonNull(_meta);
        this.infoResponse = Objects.requireNonNull(_infoResponse);
    }

    @JsonProperty("meta")
    public Meta getMeta() {
        return this.meta;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(final String name, final Object value) {
        this.additionalProperties.put(name, value);
    }

    @JsonProperty("response")
    public InfoResponse getResponse() {
        return this.infoResponse;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(final Object other) {
        return EqualsBuilder.reflectionEquals(this, other);
    }

    @JsonInclude(JsonInclude.Include.ALWAYS)
    public static class InfoResponse {
        private final User user;

        // @JsonIgnore
        private final Map<String, Object> additionalProperties =
            new HashMap<>();

        @JsonCreator
        public InfoResponse(@JsonProperty("user")
        final User _user) {
            this.user = Objects.requireNonNull(_user);
        }

        @JsonProperty("user")
        public User getUser() {
            return this.user;
        }

        @JsonAnyGetter
        public Map<String, Object> getAdditionalProperties() {
            return this.additionalProperties;
        }

        @JsonAnySetter
        public void
        setAdditionalProperty(final String name, final Object value) {
            this.additionalProperties.put(name, value);
        }

        @Override
        public String toString() {
            return ToStringBuilder.reflectionToString(this);
        }

        @Override
        public int hashCode() {
            return HashCodeBuilder.reflectionHashCode(this);
        }

        @Override
        public boolean equals(final Object other) {
            return EqualsBuilder.reflectionEquals(this, other);
        }
    }
}
